package com.test.school.controller;


import com.test.school.dto.School;
import com.test.school.service.SchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SchoolController {

  @Autowired
  SchoolService schoolService;

  @RequestMapping("/findprovice")
  @ResponseBody
  public List<String> findprovice(String name){
    return schoolService.findprovince();
  }


  @RequestMapping(value = "/liujia")
  public String liujia(){return "liujia";}

  @RequestMapping("/findalluniversity")
  @ResponseBody
  public List<School> findalluniversity(){
    return schoolService.findalluniversity();
  }


  @RequestMapping("/findfirstuniversity")
  @ResponseBody
  public List<School> findfirstuniversity(String word){
    return schoolService.findfirstuniversity(word);
  }

  @RequestMapping("/finduniversityby")
  @ResponseBody
  public List<School> finduniversityby(String region){
    return schoolService.finduniversitybyregion(region);
  }

  @RequestMapping("/finduniversitynamelike")
  @ResponseBody
  public List<School> finduniversitynamelike(String name){
    return schoolService.finduniversitynamelike(name);
  }

  @RequestMapping("/finduniversitybyname")
  @ResponseBody
  public List<School> finduniversitybyname(String name){
    return schoolService.finduniversitybyname(name);
  }
}
